package com.wx;

import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;

public class JacobTTS {
    public static void main(String[] args) {
        ActiveXComponent voice = new ActiveXComponent("Sapi.SpVoice");
        Dispatch spVoice = voice.getObject();

        // 设置音量（0-100）和语速（-10到10）
        voice.setProperty("Volume", new Variant(100));
        voice.setProperty("Rate", new Variant(1));

        // 朗读中文
        Dispatch.call(spVoice, "Speak", new Variant("郑灏毅"));
//          Dispatch.call(spVoice, "Speak", new Variant("Good morning, sir/madam."));

        spVoice.safeRelease();
    }
}
